package smb.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

@Data
@AllArgsConstructor
public class CourseSection {
    private SectionVo section;
    private CourseVo course;

    public static class rowMapper implements RowMapper<CourseSection> {
        @Override
        public CourseSection mapRow(ResultSet resultSet, int i) throws SQLException {
            SectionVo sectionVo = new SectionVo(resultSet.getString(1), resultSet.getInt(2), resultSet.getString(3));
            CourseVo courseVo = new CourseVo(resultSet.getString(4), resultSet.getString(5));
            return new CourseSection(sectionVo, courseVo);
        }
    }
}
